---
title: Oracle
sidebarTitle: Oracle
---

This is the implementation of the Oracle data handler for MindsDB.

[Oracle Database](https://www.oracle.com/database/) is a multi-model database management system produced and marketed by Oracle Corporation.

## Prerequisites

Before proceeding, ensure the following prerequisites are met:

1. Install MindsDB [locally via Docker](https://docs.mindsdb.com/setup/self-hosted/docker) or use [MindsDB Cloud](https://cloud.mindsdb.com/).
2. To connect Oracle to MindsDB, install the required dependencies following [this instruction](/setup/self-hosted/docker#install-dependencies).
3. Install or ensure access to Oracle.

## Implementation

This handler is implemented using the `oracledb` library. Please install it with the below command before using this handler.

```bash
pip install oracledb
```

The required arguments to establish a connection are as follows:

* `host` is the host name, IP address, or URL.
* `port` is the port used to make TCP/IP connection.
* `sid` is the unique identifier of the database instance.
* `user` is the database user.
* `password` is the database password.

The optional arguments are as follows:

* `disable_oob` defines whether to disable out-of-bank breaks.
* `auth_mode` defines the database privilege mode: SYSDBA, SYSOPER, or others.

## Usage

In order to make use of this handler and connect to the Oracle database in MindsDB, the following syntax can be used:

```sql
CREATE DATABASE oracle_datasource
WITH
  ENGINE = 'oracle',
  PARAMETERS = {
    "host": "127.0.0.1",
    "port": 1521,
    "sid": "ORCL",
    "user": "sys",
    "password": "password",
    "disable_oob": true,
    "auth_mode": "SYSDBA"
  };
```

The connection accepts either `sid` or `service_name` arguments to target the right database instance.

You can use this established connection to query your table as follows:

```sql
SELECT *
FROM oracle_db.my_table;
```
